package com.xuxiang.cloud.service;

import com.xuxiang.grpc.proto.HelloReply;
import com.xuxiang.grpc.proto.HelloRequest;
import com.xuxiang.grpc.proto.GreeterGrpc;
import io.grpc.stub.StreamObserver;
import net.devh.boot.grpc.server.service.GrpcService;

/**
 * @author xuxiang 2019/5/30 21:54
 */
@GrpcService
public class GreeterServerService extends GreeterGrpc.GreeterImplBase {

    @Override
    public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {
        HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + req.getName()).build();
        responseObserver.onNext(reply);
        responseObserver.onCompleted();
    }
}
